<include file="../Public/header" />
<link href="{:APPS_URL}/w3g/_static/style.css" rel="stylesheet" type="text/css" />

<script type="text/javascript" src="__THEME__/js/loadImage/js/jquery.LoadImage.js?v=1235"></script>
<link rel="stylesheet" href="__APP__/swiper/dist/idangerous.swiper.css">
<script src="__APP__/swiper/dist/idangerous.swiper.min.js"></script>

<script type="text/javascript">					
$(function(){
	// var loading_pic = "__THEME__/js/loadImage/loading.gif";
	// var target_id = "content_img_list";

	// var width = $("#detail_content_img").width()-20;	
	// $("#detail_content_img img").LoadImage(true,width,width,loading_pic, target_id);
		
	// $(".reply_content_img").each(function() {
	// 	var width = $(this).width()-20;	
 //        $(this).find('img').LoadImage(true,width,width,loading_pic, target_id);
 //    });
	

  
});
var mySwiper
function showBigImgBox(obj){
	$('.pagination').html('');
	$('.swiper-slide-duplicate').remove('');
	$('#content_img_list').html("");
	
	var old_src = $(obj).attr('src');
		
	var imgArr = new Array();
	var index = 0;
	
	$(obj).closest('.content_imgs').find('img').each(function(i, e) {
		var src = $(this).attr('src');

		if(src!=""){
			if(src==old_src){
				index = i;
			}

			src = src.replace(/_250_250./,".");	

			imgArr.push(src);
			var html = "<div class=\"swiper-slide\"><img src=\""+src+"\" width=\"100%\" /></div>";
			$('#content_img_list').append(html);

		}        
    });

	$('.device').show();

	mySwiper = new Swiper('.swiper-container',{
		pagination: '.pagination',
		loop:true,
		grabCursor: true,
		paginationClickable: true,
		calculateHeight: true,
		initialSlide:index
    })	
	//location.hash="anchor";
	$("body,html").animate({scrollTop: 0}, 0); 
}
function closeBox(){
	mySwiper.destroy();
	$('.device').hide();
}
</script>


<div id="content">
    <div id="weiba" data-title="{$weiba_name|getShort=6,'...'}" class="panel" data-selected="true"  data-menu="msgmenu" style="padding:0;">
        <header>
            <div id="header-buttons">
                <a href="javascript:history.go(-1);">
                    <div id="back" class="header-menu-link" data-back="false">
                    </div>
                </a>

                <div id="messageLink" class="header-menu-link"><a href="{:U('w3g/Index/msgbox')}"><i class="num"></i></a></div>
        <div id="menuLink" class="header-menu-link"></div>
            </div>
            <h1 class="hasback">
                {$weiba_name|getShort=6,'...'}
            </h1>
        </header>
  <div class="mainWeiba">
    <!-- <div class="path"> <a href="{:U('w3g/Weiba/forum')}">微吧</a><i>></i><a href="{:U('w3g/Weiba/forum')}#{$cate}">{$cate}</a><i>></i><a href="{:U('w3g/Weiba/detail',array('weiba_id'=>$weiba_id))}"><span class="text-required">{$weiba_name}</span></a></div> -->
    <div class="postDetail">
      <div class="pc_info">
        <dl>
          <dt><a href="{:U('w3g/Index/profile',array('uid'=>$post_detail['post_uid']))}" ><img src="{$post_detail.post_uid|getUserFace}"></a></dt>
          <dd>
            <php>$userinfo = getUserInfo($post_detail['post_uid']);</php>
            <span class="favorite">
              <php>if($mid){</php>
                <a class="unfavorite" event-args="post_id={$post_detail['post_id']}&weiba_id={$post_detail['weiba_id']}&post_uid={$post_detail['post_uid']}" href="javascript:void(0)" event-node="post_unfavorite" id="favorite" onclick="unfavorite_weiba(this, {$post_detail['post_id']},{$post_detail['post_uid']},{$post_detail['weiba_id']})" <php>if($post_detail['favorite']!=1){</php>style="display:none;"<php>}</php>>已收藏</a>
                <a event-args="post_id={$post_detail['post_id']}&weiba_id={$post_detail['weiba_id']}&post_uid={$post_detail['post_uid']}" href="javascript:void(0)" event-node="post_favorite" id="favorite" onclick="favorite_weiba(this, {$post_detail['post_id']},{$post_detail['post_uid']},{$post_detail['weiba_id']})" <php>if($post_detail['favorite']==1){</php>style="display:none;"<php>}</php>>+收藏</a>
                <php>}</php>
            </span>
            <div class="name"><a href="{:U('w3g/Index/profile','uid='.$userinfo['uid'])}">{$userinfo['uname']}</a></div>
            <div class="info">
              <p class="date">
              	{$post_detail.post_time|friendlyDate}　
                <span class="plnum">{$post_detail.reply_count}</span>　<span class="llnum">{$post_detail.read_count}</span>
              </p>
            </div>
          </dd>
        </dl>
      </div>
      <div class="pc_title">{$post_detail.title}</div>
      <div class="pc_text content_imgs" id="detail_content_img" >{$post_detail.content|bbcodewap}</div>
      <div class="pc_reply">
        {:W('WeibaReply',array('tpl'=>'w3g', 'weiba_id'=>$post_detail['weiba_id'], 'post_id'=>$post_detail['post_id'], 'post_uid'=>$mid, 'feed_id'=>$post_detail['feed_id'], 'limit'=>'20', 'order'=>'DESC', 'addtoend'=>1,'type'=>$type))}
    </div>
  </div>
</div>

<!--大图相册的效果-->
<style type="text/css">
/*大图相册的效果*/
.device {
  display:none;position: absolute;top: 0px;left: 0px;width: 100%;height: 100%;background-color: #333;z-index: 9;
}
.device .showImg{position: relative;}
.device .showImg_t{height: 38px;line-height: 38px;text-align: center;background-color: #000;color: #fff;font-size: 14px;padding: 0 20px;}
.device .showImg_close{position: absolute;right: 20px;top: 10px; color: #fff;}
.device .swiper-container {
  width: 100%;
  padding-top: 32px;
}
.device .content-slide {
  padding: 20px;  color: #fff;
}
.device .title {
  font-size: 25px;  margin-bottom: 10px;
}
.device .pagination {
  position: absolute; left: 0;  text-align: center; top: 50px;  width: 100%;  z-index: 9;
}
.device .swiper-pagination-switch {
  display: inline-block;  width: 12px;  height: 12px; background: #ccc; margin: 0 3px;  cursor: pointer;}
.device .swiper-active-switch {
  background: #e21e1f;
}
</style>

<div class="device">
  <div class="showImg">
    <a class="showImg_close" href="javascript:void(0)" onClick="closeBox()">关闭</a>
    <h1 class="showImg_t">图片浏览</h1>
    <div class="swiper-container">
      <div class="swiper-wrapper" id="content_img_list"> 
        <!--        <div class="swiper-slide">
            <img src="{$vo.img_url}" alt="{$vo.ad_name}" width="100%" height="198" />
          </div>--> 
        
      </div>
    </div>
    <div class="pagination"></div>
  </div>
</div>
</div>
<script>
$(".pc_reply a[event-node='reply_del']").click(function(){
    if(!confirm("确认删除此回复？")){
        return false;
    }
    var _this = $(this);
    var data  = _this.attr('event-args')+'&widget_appname=weiba';
    $.post("{:U('widget/WeibaReply/delReply')}", data, function(result){
        if(result == '1'){
            _this.parents('.list').remove();
        }else{
            $.ui.showMask("删除失败，请稍候再试！", true);
        }
    });
    return false;
});
$(".pc_reply a[event-node='reply_reply']").click(function(){
    window.location.href=U('w3g/Weiba/reply')+'&'+$(this).attr('event-args');
});

function addDigg(id){
    var span = $('#digg'+id);
    var data = {
        widget_appname: 'weiba',
        row_id:id
    };
    $.post('{:U("widget/ReplyDigg/addDigg")}', data, function(result){
        if(result.status == 1){
            var num = parseInt(span.attr('rel'))+1;
            span.attr('rel', num).html('<a href="javascript:;" class="like-h digg-like-yes" onclick="delDigg('+id+')">赞('+num+')</a>');
        }else{
            $.ui.showMask("点赞失败，请稍候再试！", true);
        }
    }, 'json');
}
function delDigg(id){
    var span = $('#digg'+id);
    var data = {
        widget_appname: 'weiba',
        row_id:id
    };
    $.post('{:U("widget/ReplyDigg/delDigg")}', data, function(result){
        if(result.status == 1){
            var num = parseInt(span.attr('rel'))-1;
            var zan = num>0?'赞('+num+')':'赞';
            span.attr('rel', num).html('<a href="javascript:;" onclick="addDigg('+id+')">'+zan+'</a>');
        }else{
            $.ui.showMask("取消失败，请稍候再试！", true);
        }
    }, 'json');
}
</script>
<include file="../Public/footer" />